$(function () {
    $(window).load(function () {
        var res = $.cookie("isLogin")
        console.log(res)
        $(".right4").on("click", function () {
            if (res != undefined) {
                $(this).attr("href", "http://127.0.0.1:8080/carterContent.html")
            } else {
                layer.confirm("您还未登录,请先登录", function (index) {
                    layer.close(index)
                    window.location = "/login.html"
                }, function () {
                })
            }
        })

        //登录了,
        if (res != undefined) {
            $(".login_zhuce").text("你好," + res.uname)
        } else {
            var loginStr = `
            <a href="http://127.0.0.1:8080/login.html">请登录</a> |
            <a href="http://127.0.0.1:8080/reg.html"> 免费注册</a>
            `
            $(".login_zhuce").html(loginStr)
        }

    })
})